Non-coherent read in a strongly consistent cache system for frequently read but rarely updated data

ABSTRACT

A technique relates to enabling a multiprocessor computer system to make a non-coherent request for a cache line. A first processor core sends a non-coherent fetch to a cache. In response to a second processor core having exclusive ownership of the cache line in the cache, the first processor core receives a stale copy of the cache line in the cache based on the non-coherent fetch. The non-coherent fetch is configured to obtain the stale copy for a predefined use. Cache coherency is maintained for the cache, such that the second processor core continues to have exclusive ownership of the cache line while the first processor core receives the stale copy of the cache line.

DOMESTIC PRIORITY

This application is a continuation of U.S. application Ser. No.15/727,169, titled “NON-COHERENT READ IN A STRONGLY CONSISTENT CACHESYSTEM FOR FREQUENTLY READ BUT RARELY UPDATED DATA” filed Oct. 6, 2017,the contents of which are incorporated by reference herein in itsentirety.

BACKGROUND

The present invention generally relates to a cache system in a computersystem, and more specifically, to high-performance non-coherent read (orfetch) in a strongly consistent cache system for frequently read butrarely updated data.

Strong consistency is one of the consistency models used in the domainof the concurrent programming (e.g., in distributed shared memory,distributed transactions, etc.). The protocol supports strongconsistency if all accesses to the shared memory (e.g., shared cached)are seen by all parallel processes (or nodes, processors, etc.) in thesame order (sequentially). Therefore, only one consistent state can beobserved, as opposed to weak consistency, where different parallelprocesses (or nodes, etc.) can perceive variables in different states.

In computer science, consistency models are used in distributed systemslike distributed shared memory systems or distributed data stores (suchas file systems, databases, optimistic replication systems or Webcaching). The system is said to support a given model if operations onmemory follow specific rules. The data consistency model specifies acontract between programmer and system, in which the system guaranteesthat if the programmer follows the rules, the memory will be consistentand the results of memory operations will be predictable. This isdifferent from cache coherence. Consistency is an issue (that occurs insystems that are cached or cache-less) and is about the consistency ofdata with respect to all processors. Consistency is not handled bycoherence as coherence deals with maintaining a global order in whichwrites only to a single location or a single variable are seen by allprocessors. Consistency deals with the ordering of operations tomultiple locations with respect to all processors.

SUMMARY

Embodiments of the present invention are directed to acomputer-implemented method for enabling a multiprocessor computersystem to make a non-coherent request for a cache line. A non-limitingexample of the computer-implemented method includes sending by a firstprocessor core a non-coherent fetch to a cache, and in response to asecond processor core having exclusive ownership of the cache line inthe cache, receiving by the first processor core a stale copy of thecache line in the cache based on the non-coherent fetch. Thenon-coherent fetch is configured to obtain the stale copy for apredefined use. Cache coherency is maintained for the cache, such thatthe second processor core continues to have exclusive ownership of thecache line while the first processor core receives the stale copy of thecache line.

Embodiments of the present invention are directed to a multiprocessorcomputer system making a non-coherent request for a cache line. Anon-limiting example of the system includes a processing circuit and astorage medium readable by the processing circuit and storinginstructions that, when executed by the processing circuit, cause theprocessing circuit to perform a method. A non-limiting example of themethod includes sending by a first processor core a non-coherent fetchto a cache, and in response to a second processor core having exclusiveownership of the cache line in the cache, receiving by the firstprocessor core a stale copy of the cache line in the cache based on thenon-coherent fetch. The non-coherent fetch is configured to obtain thestale copy for a predefined use. Cache coherency is maintained for thecache, such that the second processor core continues to have exclusiveownership of the cache line while the first processor core receives thestale copy of the cache line.

Embodiments of the invention are directed to a computer program productfor enabling a multiprocessor computer system to make a non-coherentrequest for a cache line, the computer program product comprising acomputer readable storage medium having program instructions embodiedtherewith, where the computer readable storage medium is not atransitory signal per se. The program instructions are readable by themultiprocessor computer system to cause the multiprocessor computersystem to perform a method. A non-limiting example of the methodincludes sending by a first processor core a non-coherent fetch to acache, and in response to a second processor core having exclusiveownership of the cache line in the cache, receiving by the firstprocessor core a stale copy of the cache line in the cache based on thenon-coherent fetch. The non-coherent fetch is configured to obtain thestale copy for a predefined use. Cache coherency is maintained for thecache, such that the second processor core continues to have exclusiveownership of the cache line while the first processor core receives thestale copy of the cache line.

Additional technical features and benefits are realized through thetechniques of the present invention. Embodiments and aspects of theinvention are described in detail herein and are considered a part ofthe claimed subject matter. For a better understanding, refer to thedetailed description and to the drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The specifics of the exclusive rights described herein are particularlypointed out and distinctly claimed in the claims at the conclusion ofthe specification. The foregoing and other features and advantages ofthe embodiments of the invention are apparent from the followingdetailed description taken in conjunction with the accompanying drawingsin which:

FIG. 1 depicts a schematic of an example computing node/system accordingto embodiments of the present invention;

FIG. 2 depicts a simplified view of the computer system/server accordingto embodiments of the present invention;

FIG. 3 depicts an example of an exclusive fetch;

FIG. 4 depicts an example of a non-coherent fetch according toembodiments of the present invention; and

FIG. 5 depicts a flow chart of a computer-implemented method forenabling a multiprocessor computer system to make non-coherent requestsaccording to embodiments of the present invention.

The diagrams depicted herein are illustrative. There can be manyvariations to the diagram or the operations described therein withoutdeparting from the spirit of the invention. For instance, the actionscan be performed in a differing order or actions can be added, deletedor modified. Also, the term “coupled” and variations thereof describeshaving a communications path between two elements and does not imply adirect connection between the elements with no interveningelements/connections between them. All of these variations areconsidered a part of the specification.

In the accompanying figures and following detailed description of thedisclosed embodiments, the various elements illustrated in the figuresare provided with two or three digit reference numbers. With minorexceptions, the leftmost digit(s) of each reference number correspondsto the figure in which its element is first illustrated.

DETAILED DESCRIPTION

Various embodiments of the invention are described herein with referenceto the related drawings. Alternative embodiments of the invention can bedevised without departing from the scope of this invention. Variousconnections and positional relationships (e.g., over, below, adjacent,etc.) are set forth between elements in the following description and inthe drawings. These connections and/or positional relationships, unlessspecified otherwise, can be direct or indirect, and the presentinvention is not intended to be limiting in this respect. Accordingly, acoupling of entities can refer to either a direct or an indirectcoupling, and a positional relationship between entities can be a director indirect positional relationship. Moreover, the various tasks andprocess steps described herein can be incorporated into a morecomprehensive procedure or process having additional steps orfunctionality not described in detail herein.

The following definitions and abbreviations are to be used for theinterpretation of the claims and the specification. As used herein, theterms “comprises,” “comprising,” “includes,” “including,” “has,”“having,” “contains” or “containing,” or any other variation thereof,are intended to cover a non-exclusive inclusion. For example, acomposition, a mixture, process, method, article, or apparatus thatcomprises a list of elements is not necessarily limited to only thoseelements but can include other elements not expressly listed or inherentto such composition, mixture, process, method, article, or apparatus.

Additionally, the term “exemplary” is used herein to mean “serving as anexample, instance or illustration.” Any embodiment or design describedherein as “exemplary” is not necessarily to be construed as preferred oradvantageous over other embodiments or designs. The terms “at least one”and “one or more” may be understood to include any integer numbergreater than or equal to one, i.e. one, two, three, four, etc. The terms“a plurality” may be understood to include any integer number greaterthan or equal to two, i.e. two, three, four, five, etc. The term“connection” may include both an indirect “connection” and a direct“connection.”

The terms “about,” “substantially,” “approximately,” and variationsthereof, are intended to include the degree of error associated withmeasurement of the particular quantity based upon the equipmentavailable at the time of filing the application. For example, “about”can include a range of ±8% or 5%, or 2% of a given value.

For the sake of brevity, conventional techniques related to making andusing aspects of the invention may or may not be described in detailherein. In particular, various aspects of computing systems and specificcomputer programs to implement the various technical features describedherein are well known. Accordingly, in the interest of brevity, manyconventional implementation details are only mentioned briefly herein orare omitted entirely without providing the well-known system and/orprocess details.

Turning now to an overview of technologies that are more specificallyrelevant to aspects of the invention, software has use cases where cachelines are frequently referenced by multiple processors, while one ormore cores may be updating the state of the cache line. Referencing thecache line can be considered monitoring the cache line. These additionalmonitoring cores (which are referencing the cache line) generateinterference to the mainline processing, and the monitoring cores may bepolling the cache line for updates, but do not need the most recent copyof the data. This introduces multiprocessor scaling effects which can beproblematic. For example, a dirty lock is stolen from an updatingprocessor by another core's load and takes time for the initiating core(which was originally updating the cache line) to reacquire and unlock.In other words, a first core is updating the cache line, and amonitoring core requests and takes control of the cache line from thefirst core before the first core finishes its update to the cache line.However, the monitoring core only wants to poll the cache line in theexample use case. State-of-the-art techniques across the industryrecommend careful coding techniques to limit the damage, whichessentially fixes the software constructs to work within the scope ofthe hardware design.

Turning now to an overview of the aspects of the invention, one or moreembodiments of the invention address the above-described shortcomings ofthe prior art by providing a new “Dirty-Read Fetch” instruction. TheDirty-Read Fetch instruction is configured to facilitate multipleprocessors' attempts to read to a single (the same) cache line withoutinterrupting existing operations of another processor (e.g., updatingthe cache line) by: 1) New Dirty-Read Fetch instruction (DR) whichprovides the requesting processor access to a copy of the cache line fora one-time reference with a snapshot of the current state in the nearestcache on a L1 miss (which could be stale). 2) Existing operations inflight to the cache line from other processor(s) would not be impacted.

The above-described aspects of the invention address the shortcomings ofthe prior art by providing processors and/or cache controllers havinghardware, firmware, and/or microcode which uses the new Dirty-Fetchinstruction to indicate a storage read that does not require the latestcopy of the data. For example, a requesting processor makes a requestfor data, and if it hits (i.e., is successful) in the local privatecache (L1/L2) in any state, the request returns data as usual. If therequest misses in the local cache, the requesting processor sends a“dirty fetch” request to shared cache (L3). The dirty fetch in theDirty-Read Fetch instruction. The shared cache (e.g., via the cachecontroller) returns data with a traditional state if there is noconflict to ownership, i.e., if the cache line is not owned exclusive(exclusive ownership) by another processor. On the other hand, theshared cache (e.g., via the cache controller) returns data with the“dirty” state if there is an ownership conflict, i.e., the cache line isowned exclusive by another processor and the other processor may beupdating the cache line. After receiving the data of the cache line inthe dirty state, the requesting processor now marks its local cache tohave its own state as “dirty fetch” (DNC) and returns data to pipelineusage. On the next instruction fetch to a cache line with a “dirtyfetch” state (in the local cache of the requesting processor) thisrequest to the cache line having the direct fetch is treated as a miss,and the local cache of the requesting processor will request the cacheline from the shared cache in traditional way. In other words, thedirty/stale copy of the cache line that has been brought back to thelocal cache (L1/L2) of the requesting processor is (only) used once, andthe dirty cache line in the local cache cannot be used again, therebyresulting in a miss at the local cache for the dirty cache line.

Additionally, embodiments improve the functioning of the computer byimproving the cache memory system such that a processor is notinterrupted from updating a cache line when other processors only need astale/copy of the cache line. This reduces processing time be avoidingunnecessary interruptions.

Turning now to a more detailed description of aspects of the presentinvention, FIG. 1 depicts a schematic of an example computing nodeaccording to embodiments of the present invention. The computing nodeincludes a computer system/server 12, which can be operational withnumerous other general purpose or special purpose computing systemenvironments or configurations. The optimization can be included in aserver, mainframe, etc., and the computer system/server 12 can berepresentative of various types of computer systems on which theoptimization (and query) can run.

Examples of well-known computing systems, environments, and/orconfigurations that may be suitable for use with computer system/server12 include, but are not limited to, personal computer systems, servercomputer systems, thin clients, thick clients, hand-held or laptopdevices, multiprocessor systems, microprocessor-based systems, set topboxes, programmable consumer electronics, network PCs, minicomputersystems, mainframe computer systems, and distributed cloud computingenvironments that include any of the above systems or devices, and thelike.

Computer system/server 12 may be described in the general context ofcomputer system-executable instructions, such as program modules, beingexecuted by a computer system. Generally, program modules may includeroutines, programs, objects, components, logic, data structures, and soon that perform particular tasks or implement particular abstract datatypes. Computer system/server 12 may be practiced in distributed cloudcomputing environments where tasks are performed by remote processingdevices that are linked through a communications network. In adistributed cloud computing environment, program modules may be locatedin both local and remote computer system storage media including memorystorage devices.

The components of computer system/server 12 may include, but are notlimited to, one or more processors or processing units 16, a systemmemory 28, and a bus 18 that couples various system components includingsystem memory 28 to processor 16. Bus 18 represents one or more of anyof several types of bus structures, including a memory bus or memorycontroller, a peripheral bus, an accelerated graphics port, and aprocessor or local bus using any of a variety of bus architectures. Byway of example, and not limitation, such architectures include IndustryStandard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus,Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA)local bus, and Peripheral Component Interconnects (PCI) bus.

Computer system/server 12 typically includes a variety of computersystem readable media. Such media may be any available media that isaccessible by computer system/server 12, and it includes both volatileand non-volatile media, removable and non-removable media. The systemmemory 28 can include computer system readable media in the form ofvolatile memory, such as random access memory (RAM) 30 and/or cachememory 32. Computer system/server 12 may further include otherremovable/non-removable, volatile/non-volatile computer system storagemedia. By way of example only, storage system 34 can be provided forreading from and writing to a nonremovable, non-volatile magnetic media(not shown and typically called a “hard drive”). Although not shown, amagnetic disk drive for reading from and writing to a removable,non-volatile magnetic disk (e.g., a “floppy disk”), and an optical diskdrive for reading from or writing to a removable, non-volatile opticaldisk such as a CD-ROM, DVD-ROM or other optical media can be provided.In such instances, each can be connected to bus 18 by one or more datamedia interfaces. Memory 28 may include at least one program producthaving a set (e.g., at least one) of program modules that are configuredto carry out the functions of embodiments of the invention.

Program/utility 40, having a set (at least one) of program modules 42,may be stored in memory 28 by way of example, and not limitation, aswell as an operating system, one or more application programs, otherprogram modules, and program data. Each of the operating system, one ormore application programs, other program modules, and program data orsome combination thereof, may include an implementation of a networkingenvironment. Program modules 42 generally carry out the functions and/ormethodologies of embodiments of the invention as described herein.

Computer system/server 12 may also communicate with one or more externaldevices 14 such as a keyboard, a pointing device, a display 24, etc.;one or more devices that enable a user to interact with computersystem/server 12; and/or any devices (e.g., network card, modem, etc.)that enable computer system/server 12 to communicate with one or moreother computing devices. Such communication can occur via Input/Output(I/O) interfaces 22. Still yet, computer system/server 12 cancommunicate with one or more networks such as a local area network(LAN), a general wide area network (WAN), and/or a public network (e.g.,the Internet) via network adapter 20. As depicted, network adapter 20communicates with the other components of computer system/server 12 viabus 18. It should be understood that although not shown, other hardwareand/or software components could be used in conjunction with computersystem/server 12. Examples, include but are not limited to: microcode,device drivers, redundant processing units, external disk drive arrays,RAID systems, tape drives, and data archival storage systems, etc.

FIG. 2 depicts a simplified view of the of the computer system/server 12according to embodiments of the present invention. Accordingly, someelements of the computer system/server 12 are not shown so as not toobscure the figure. However, additional detail of the processing unit 16is illustrated for example purposes. FIG. 2 shows details of theprocessing unit 16 which is a multiprocessor (processing circuitry). Forsimplification, only three processors 202_0 through 202_2 of themultiprocessor 16 are shown, and it is understood that themultiprocessor 16 can have more than three processors. Processor 202_0has one or more cores, and core 0 is illustrated. Processor 202_1 hasone or more cores, and core 1 is illustrated. Similarly, processor 202_2has one or more cores, and core 2 is illustrated. Each processor 202 hasits own local cache 204. The local cache 204 of processors 202_0 through202_2 can each include a local cache L1 and a local cache L2. Someprocessors may only have an L1 cache. If both the L1 and L2 caches arepresent, the L1 cache is closer to the processor core.

FIG. 2 also illustrates a cache controller 206. The cache controller isa device which is used to control the transfer of data between theprocessor, main memory, and the cache memory.

The shared cache 32 is designed with strong consistency in which thecache controller 206 and/or processors 202 have hardware/softwareprotocol to support strong consistency such that all accesses to theshared memory (e.g., shared cached 32) are seen by all parallelprocesses (or nodes, processors 202, etc.) in the same order(sequentially). Therefore, only one consistent state can be observed foreach cache line where different parallel processes (or nodes, etc.) canperceive variables in different states.

A scenario is provided below. There are many cases in a computer systemwhere values such as counters or tokens are read or fetched at a highfrequency but are actually updated at a low frequency. A token is anobject (in software or in hardware) which represents the right toperform some operation. A counter can increase each time a count istaken of a specified item or instruction. If the data requested is inthe L1 cache when reading, then the fetch is fast. However, if data isnot frequently in the L1 cache due to other activity that uses the L1cache forcing the value out, then the next fetch will incur a cache missat the L1 cache. Because the data is read frequently, the overhead ofthe cache miss can be significant. For users/applications where thevalue does not have to be perfectly accurate like performance monitorscollecting data, this overhead can be significant. In most cases,performance monitors do not require that the data be perfectly accurateor coherent. As such, a non-coherent value which is close to the currentvalue is sufficient. Given the frequency that the performance monitorsare reading data, using the non-coherent value (which is a stale copy)would be close enough to the current value (i.e., the actual value). Aperformance monitor is a software program executed by any of theprocessors 202 which allows a computer user and/or the monitoringprogram to view and monitor the performance of the computer system 12either in real time or from a log.

The shared cache 32 (and the memory 28 in general) can operate under theMESI protocol as understood by one skilled in the art. The MESI protocolis an Invalidate-based cache coherence protocol, and is one of the mostcommon protocols which support write-back caches. By using write backcaches, one can save a lot on bandwidth which is generally wasted on awrite through cache. There is always a dirty state present in write backcaches which indicates that the data in the cache is different from thatin main memory. The protocol requires cache to cache transfer on a missif the block resides in another cache. The letters in the acronym MESIrepresent four exclusive states that a cache line can be marked with(encoded using two additional bits):

Modified (M): The cache line is present only in the current cache, andis dirty (i.e., it has been modified (M state) from the value in mainmemory). The cache is required to write the data back to main memory atsome time in the future, before permitting any other read of the (nolonger valid) main memory state. The write-back changes the line to theShared state (S).

Exclusive (E): The cache line is present only in the current cache, butis clean (i.e., it matches main memory). It may be changed to the Sharedstate at any time, in response to a read request. Alternatively, it maybe changed to the Modified state when writing to it.

Shared(S): Indicates that this cache line may be stored in other cachesof the machine and is clean—it matches the main memory. The line may bediscarded (changed to the Invalid state) at any time.

Invalid (I): Indicates that this cache line is invalid (unused).

FIG. 3 depicts a scenario using the MESI protocol which can occur in thestate-of-the-art. The times are illustrated as time T0, time T1, andtime T2 in which T0<T1<T2. FIG. 3 depicts exclusive fetching by 3different processors/cores. An exclusive fetch is a processor fetch withintent to modify the contents of a cache line. FIG. 3 depicts asimplified version of processors 202 and the shared cache 32. The cachecontroller 206 is not shown. Also, the assumption is that there is aglobal counter in the shared cache.

At time T0, the core 0 executes an exclusive fetch to cache line A inthe shared cache 32, because there was a cache miss in the local cachesL1, L2 of the core 0. There is a cache hit in the shared cache 32 (L3),and the core 0 receives exclusive ownership of the shared cache 32. Uponreceiving the exclusive ownership of the cache line, core 0 can nowstore into line A (1 store, hot global counter). For example, the core 0is in the process of bringing line A back to the core 0 in order tostore line A (i.e., store the value/data) in the local cache (L1 and/orL2) of core 0.

At time T1,core 1 executes an exclusive fetch to cache line A in theshared cache 32 because there was a cache miss in the local caches L1,L2 of the core 1, and there is a cache hit in the shared cache 32 (L3).Upon core 1 initiating the exclusive fetch and upon core 1 hitting onthe cache entry in the L3 shared cache 32, due to MESI coherencyprotocols, a cross-invalidate (XI) request is sent to core 0 to requestthat the processor relinquish ownership of the cache line A. In otherwords, the core 0 receives the cross-invalidate (XI) to invalidateprevious copies of the data in the local caches that relate to the cacheline A. The core 0 is in the process of performing a compare and swapsuch that the value of the cache line A brought in from the shared cache32 is to be compared to the previous value in the local cache (L1 and/orL2), and the value of cache line A will be stored in the local cache ofcore 0 if the values of cache line A and the local cache are different.However, no store is able to occur in the local cache of core 0 becausecore 1 has now taken exclusive ownership of cache line A in the sharedcache 32 away from core 0, and thus the compare and swap procedure fails(i.e., the compare and swap was interrupted before completion so nostore occurs).

At time T2, core 2 executes an exclusive fetch to cache line A in theshared cache 32 because there was a cache miss in the local caches L1,L2 of the core 2, and there is a cache hit in the shared cache 32 (L3).Upon core 2 initiating the exclusive fetch and upon core 2 hitting onthe cache entry in the L3 shared cache 32, due to MESI coherencyprotocols, a cross-invalidate (XI) request is sent to core 1 to requestthat the processor relinquishes ownership of the cache line A. In otherwords, core 1 receives a cross-invalidate (XI) to invalidate previouscopies of the data in the local caches that relate to the cache line A.The core 1 is in the process of performing a compare and swap such thatthe value of the cache line A brought in from the shared cache 32 is tobe compared to the previous value in the local cache (L1 and/or L2) andthe value of cache line A will be stored in the local cache of core 1 ifthe values of cache line A and the local cache are different. However,no store is able to occur in the local cache of core 1 because core 2has now taken exclusive ownership of the shared cache 32 away from core1, and thus the compare and swap procedure fails (i.e., the compare andswap was interrupted before completion so no store occurs).

FIG. 4 depicts a scenario using the MESI protocol and the new Dirty-ReadFetch instruction according to embodiments of the present invention.FIG. 4 uses the same scenario as FIG. 3 but uses the New Dirty-ReadFetch instruction instead of the exclusive fetch. Similarly, the timesT0, T1, and T2 are illustrated in which T0<T1<T2, and FIG. 4 depictsfetching by 3 different processors/cores. FIG. 4 depicts a simplifiedversion of processors 202 and the shared cache 32, without showing thecache controller 206. Again, it is assumed that there is a globalcounter in the shared cache on at least one bit of the cache line A.

At time T0 (as discussed above), the core 0 executes an exclusive fetchto cache line A in the shared cache 32, because there was a cache missin the local caches L1, L2 of the core 0. There is a cache hit in theshared cache 32 (L3), and the core 0 receives exclusive ownership of theshared cache 32. The core 0 is configured to store line A (1 store, hotglobal counter). For example, core 0 is in the process of bringing lineA back to the core 0 in order to store line A (i.e., stored thevalue/data) in the local cache (L1 and/or L2) of core 0.

At time T1, core 1 executes a Dirty-Read Fetch instruction to cache lineA in the shared cache 32 because there was a cache miss in the localcaches L1, L2 of the core 1, and there is a cache hit in the sharedcache 32 (L3). Because core 1 now executes a Dirty-Read Fetchinstruction, no cross-invalidate (XI) is sent to core 0. As noted above,to facilitate multiple processors' attempting to read to a single cacheline without interrupting existing operations of core 0, the Dirty-ReadFetch instruction is configured to allow the requesting processor (e.g.,core 1) access to a copy of the cache line A for a one-timereference/use with a snapshot of the current state/value (which could bestale/old). Therefore, existing operations in flight to the cache line Afrom other processors, such as core 0, are not be impacted/interrupted.Accordingly, core 0 is in the process of performing a compare and swapsuch that the value of the cache line A brought in from the shared cache32 is to be compared to the previous value in the local cache (L1 and/orL2), and the value of cache line A will be stored in the local cache ofcore 0 if the values of cache line A and the local cache are different.Unlike FIG. 3, FIG. 4 shows that the store occurs in the local cache ofcore 0 because core 1 does not take exclusive ownership of the cacheline A in shared cache 32 away from core 0. Instead, core 0 is allowedto complete the compare and swap procedure (i.e., the compare and swapis not interrupted), and the core 0 stores the value of the cache line Ato the local cache L1 and/or L2. Back to core 1, core 1 receives thestale/dirty copy of the cache line A using the Dirty-Read Fetchinstruction, and core 1 stores and marks this stale copy in its localcache (L1 and/or L2) as do not copy state (one time use only) such thatany subsequent fetch to the local cache of core 1 (for the stale copy)results in a cache miss. This means that any subsequent fetch to thelocal cache (L1, L2) for the stale copy will then result in a fetch tothe shared cache 32 (L3).

At time T2, core 2 executes a Dirty-Read Fetch instruction to cache lineA in the shared cache 32 because there was a cache miss in the localcaches L1, L2 of the core 1, and there is a cache hit in the sharedcache 32 (L3). As noted above, no cross-invalidate (XI) is sent to core1. The core 2 receives the stale/dirty copy of the cache line A usingthe Dirty-Read Fetch instruction, and the core 2 stores and marks thisstale copy in its local cache (L1 and/or L2) as do not copy state (oneuse only) such that any subsequent fetch to the local cache of core 2(for the stale copy) results in a cache miss. This means that anysubsequent fetch to the local cache of core 2 for the stale copy willthen result in a fetch to the shared cache 32 (L3).

The core 0 continues to have exclusive ownership of the cache line A ofthe shared cache 32 even after the Dirty-Read Fetch instructions havebeen requested for cache line A by cores 1 and 2.

As can be seen, the Dirty-Read Fetch instruction protocol enables theprocessor core updating cache line to maintain ‘write’ access to ashared cache line while other processor cores can ‘snoop’ for updateswithout stealing the cache line. Embodiments eliminate the need for XI's(cross-invalidates) and serialization overhead until an appropriatepoint of intervention is attained. The Dirty-Read Fetch instruction doesnot violate cache coherency, because in the scenario above only core 0is able to update the cache line A (i.e., core 0 has exclusiveownership) in the shared cache L3 but the cores 1 and 2 only inspect thecache line. After performing the dirty read via the Dirty-Read Fetchinstruction, the cores 1 and 2 can optionally store a private copy ofthe cache line A back to their respective local caches and/or the cores1 and 2 do not have to install the dirty copy.

The Dirty-Read Fetch instruction can be utilized in a situation in whichthe cores 1 and 2 are executing a monitoring program, and the monitoringprogram can be a program 42 in the memory 28 of the computer system 12.The monitoring program may only need to make a comparison to the stalecopy (value) to check whether the value has reached a predefinedthreshold. The cache controller 206 is configured to perform Dirty-ReadFetch instruction in cooperation with the processor 202.

FIG. 5 depicts a flow chart of a computer-implemented method forenabling a multiprocessor computer system 12 to make a non-coherentrequest for a cache line (e.g., cache line A) according to embodimentsof the present invention.

At block 502, a first processor core (e.g., core 1 of the multiprocessorcores 16) sends a non-coherent fetch (e.g., Dirty-Read Fetchinstruction) to a shared cache 32. For example, the non-coherent fetchinstruction can be sent to the cache controller 206 of the shared cache32 from the core 1 as discussed in the example scenario above.

At block 504, in response to a second processor core (e.g., core 0 ofthe multiprocessor cores 16) having exclusive ownership of the cacheline (e.g., cache line A) in the shared cache 32, the first processorcore receives a stale copy of the cache line in the shared cache basedon the non-coherent fetch. For example, the core 1 receives a stale copyof cache line A from the cache controller 206 in accordance with thenon-coherent fetch.

At block 506, the non-coherent fetch is configured to obtain the stalecopy for a predefined use. At block 508, cache coherency is maintainedfor the shared cache 32, such that the second processor core continuesto have exclusive ownership of the cache line while the first processorreceives the stale copy of the cache line. For example, core 0 continuesto have exclusive ownership of the cache line A even while cores 1 and 2respectively obtain a stale copy of cache line A by issuing Dirty-ReadFetch instructions.

The predefined use is a single use for the stale copy. The predefineduse limits/restricts use of the stale copy by the first processor core(e.g., core 1) to comparing a value of the stale copy to a predefinedvalue (which may be in a register of core 1). The stale copy isdiscarded if the value of the stale copy does not reach a threshold ofthe predefined value, and if the value of the stale copy does reach thethreshold of the predefined value, the first processor core (e.g., core1) is configured to send an exclusive fetch to the shared cache suchthat the first processor core can obtain exclusive ownership of thecache line in the shared cache. The exclusive fetch is a normal fetchinstruction that gives exclusive ownership to core 1.

The predefined use permits the second processor core (e.g., core 0 fromthe scenario above) to store the stale copy in a local cache 204, suchas L1 and/or L2. A cache line of the local cache 204 having the stalecopy is marked dirty by the first processor core (e.g., core 1), suchthat any subsequent fetch to the local cache (of core 1) for the stalecopy results in a cache miss based on the predefined use. When thesecond processor (e.g., core 0) makes updates to the (value of the)cache line (cache line A), the (value of the) stale copy received by thefirst processor (e.g., core 1) is different from the (value of the)cache line updated by the second processor core.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instruction by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdescribed herein.

1. A computer-implemented method for enabling a multiprocessor computersystem to make a non-coherent request for a cache line in a cache, themethod comprising: sending by a first processor core a non-coherentfetch to the cache; and in response to a second processor core havingexclusive ownership of the cache line in the cache, receiving by thefirst processor core a stale copy of the cache line in the cache basedon the non-coherent fetch concurrently with the second processor corehaving the exclusive ownership of the cache line in the cache, theexclusive ownership being different from a shared state; wherein thenon-coherent fetch is configured to obtain the stale copy for apredefined use; wherein cache coherency is maintained for the cache,such that the second processor core continues to have the exclusiveownership of the cache line while the first processor core receives thestale copy of the cache line.
 2. The computer-implemented method ofclaim 1, wherein the predefined use is a single use for the stale copy.3. The computer-implemented method of claim 1, wherein the predefineduse limits use of the stale copy by the first processor core tocomparing a value of the stale copy to a predefined value.
 4. Thecomputer-implemented method of claim 1, wherein the cache is a sharedcache system.
 5. The computer-implemented method of claim 1, wherein thepredefined use permits the second processor core to store the stale copyin a local cache.
 6. The computer-implemented method of claim 5, whereina cache line of the local cache having the stale copy is marked invalid,such that any subsequent fetch to the local cache for the stale copyresults in a cache miss based on the predefined use.
 7. Thecomputer-implemented method of claim 1, wherein, when the secondprocessor core makes updates to the cache line, the stale copy receivedby the first processor core is different from the cache line updated bythe second processor core.